package com.edgar.plugin.hooks;

import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.os.Looper;

import com.edgar.plugin.pm.Plugin;

/**
 * Created by Edgar on 2018/2/12.
 */
public class PluginContextImpl extends ContextWrapper{

    private Plugin mPlugin;

    public PluginContextImpl(Plugin plugin) {
        super(plugin.getHostContext());
        mPlugin = plugin;
    }

    @Override
    public AssetManager getAssets() {
        return getResources().getAssets();
    }

    @Override
    public Resources getResources() {
        return mPlugin.getResources();
    }

    @Override
    public Resources.Theme getTheme() {
        return mPlugin.getTheme();
    }

    @Override
    public Looper getMainLooper() {
        return mPlugin.getMainLooper();
    }
}